package cmd

import (
	"fmt"
	"gitee/zeqjone/gen/conf"

	"github.com/spf13/cobra"
	"github.com/spf13/viper"
)

var (
	configCmd = &cobra.Command{
		Use:   "config",
		Short: "gen project config detail",
		Long:  "gen project config detail",
		Run: func(c *cobra.Command, args []string) {
			fmt.Printf("config list as below:\n")

			for _, s := range conf.ConfigKeys {
				if s == conf.MysqlSkippedTables {
					fmt.Printf("%20s: %v\n", s, viper.GetStringSlice(s))
				} else {
					fmt.Printf("%20s: %v\n", s, viper.GetString(s))
				}
			}
		},
	}
)

func init() {
	rootCmd.AddCommand(configCmd)
}
